<html>
<head><meta charset="utf-8"><title>Incorrect panic warning? · edition 2021 · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/index.html">edition 2021</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/Incorrect.20panic.20warning.3F.html">Incorrect panic warning?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="246447243"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/Incorrect%20panic%20warning%3F/near/246447243" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/Incorrect.20panic.20warning.3F.html#246447243">(Jul 19 2021 at 12:19)</a>:</h4>
<p><code>panic("{{")</code> currently warns even though the brace is escaped. Will this really not work in Rust 2021?</p>



<a name="246447489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/Incorrect%20panic%20warning%3F/near/246447489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Poliorcetics <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/Incorrect.20panic.20warning.3F.html#246447489">(Jul 19 2021 at 12:22)</a>:</h4>
<p>And the proposed fix produces the wrong output</p>



<a name="246447496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/Incorrect%20panic%20warning%3F/near/246447496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/Incorrect.20panic.20warning.3F.html#246447496">(Jul 19 2021 at 12:22)</a>:</h4>
<p>It doesn't warn in the 2021 edition. In the 2015 and 2018 edition it would cause the string "{{" to be uses as panic payload, while in the 2021 edition it would result in <code>{</code>.</p>



<a name="246447530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/Incorrect%20panic%20warning%3F/near/246447530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/Incorrect.20panic.20warning.3F.html#246447530">(Jul 19 2021 at 12:22)</a>:</h4>
<p><span class="user-mention" data-user-id="224872">@rylev</span> it will work, but produce a different result. the panic message is "{{" in the current edition, and "{" in the new edition.</p>



<a name="246447563"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/Incorrect%20panic%20warning%3F/near/246447563" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Poliorcetics <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/Incorrect.20panic.20warning.3F.html#246447563">(Jul 19 2021 at 12:23)</a>:</h4>
<p>Uh, I misunderstood the warning then</p>



<a name="246448535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/Incorrect%20panic%20warning%3F/near/246448535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/Incorrect.20panic.20warning.3F.html#246448535">(Jul 19 2021 at 12:34)</a>:</h4>
<p><span class="user-mention silent" data-user-id="310399">Mara</span> <a href="#narrow/stream/268952-edition-2021/topic/Incorrect.20panic.20warning.3F/near/246447530">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="224872">rylev</span> it will work, but produce a different result. the panic message is "{{" in the current edition, and "{" in the new edition.</p>
</blockquote>
<p>Ok then I did understand things correctly. Perhaps "incorrect" is not the right term to describe, but the warning does seem incomplete. Ideally it would mention that the message output would change.</p>



<a name="246448619"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/Incorrect%20panic%20warning%3F/near/246448619" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/Incorrect.20panic.20warning.3F.html#246448619">(Jul 19 2021 at 12:35)</a>:</h4>
<p>it's just a warning for people who use braces in the panic message, saying that 'hey, this isn't actually parsed as a format string'</p>



<a name="246448678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/Incorrect%20panic%20warning%3F/near/246448678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/Incorrect.20panic.20warning.3F.html#246448678">(Jul 19 2021 at 12:36)</a>:</h4>
<p>with {{ it just happens to also be a valid format string without arguments. but the same warning happens for {} or other combinations of braces</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>